﻿namespace Yom.WebService
{
    using System;
    using System.Web;
    using System.Web.UI;
    using Yom.Common;
    using Yom.WebService.Setup;

    public class _Setup : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Clear();
            context.Response.AppendHeader("Pragma", "no-cache");
            context.Response.AppendHeader("Cache-Control", "no-cache");
            context.Response.AppendHeader("Content-Type", "text/html; charset=utf-8");

            string Action = Factory.Request("Action");

            switch (Action)
            {
                case "License":
                    new SetupLicense().OutWrite();
                    break;
                case "CheckRun":
                    new SetupCheckRun().OutWrite();
                    break;
                case "Connect":
                    new SetupConnect().OutWrite();
                    break;
                case "SelectDB":
                    new SetupSelectDB().OutWrite();
                    break;
                case "Import":
                    new SetupImport().OutWrite();
                    break;
                case "CreateUser":
                    new SetupCreateUser().OutWrite();
                    break;
                case "End":
                    new SetupEnd().OutWrite();
                    break;
                default:
                    new SetupIndex().OutWrite();
                    break;
            }
        }

        public bool IsReusable
        {
            get { return false; }
        }
    }
}